//
//  Untitled.swift
//  KeyboardProject
//
//  Created by Hay Huang on 2025/7/29.
//

import React

@objc(KeyboardViewModule)
class KeyboardViewModule: RCTEventEmitter {
  
  override static func moduleName() -> String! { "KeyboardViewModule" }

  weak var keyboardViewController: KeyboardViewController?
  
  override func supportedEvents() -> [String]! {
    return ["onKeyPress"]
  }
  
  @objc override static func requiresMainQueueSetup() -> Bool {
      return true
  }
  
  @objc func insertText(_ text: String) {
    DispatchQueue.main.async {
      self.keyboardViewController?.textDocumentProxy.insertText(text)
    }
  }
  
}
